<template>
	<view>
		<view class="list-item"   v-for="item in newsList" :key="item.id" >
			<view  style="display: flex;">
				
				<view class="center">
					<view class="name">
						
						<text class="time">{{item.create_time}}</text>
					</view>
					<view class="content">
						{{item.content}}
						
					</view>
				</view>
			</view>
		
		</view>
		<noDatas :xxxList="newsList" :status="status"></noDatas>
	</view>
</template>

<script>
	import { service } from '../../api/other';
	export default {
		data() {
			return {
			page: 1,
			size: 20,
			status: 'loadmore', //加载前值为loadmore，加载中为loading，没有数据为nomore
			newsList:[],
			}
		},
		onLoad() {
			this.initList()
		},
		methods: {
		initList() {
			let data = {
				page:this.page,
				page_size:this.size
			}
			service(data).then(res => {
				console.log(res);
				if (res.code == 1) {
					let list = res.data.data;
					this.newsList = this.page == 1 ? list : this.newsList.concat(list);
					console.log(this.newsList);
					if (list.length < this.size) this.status = 'nomore';
				}
			})
		},
			// 初始化列表
	
		},
		onPullDownRefresh() {
			console.log('下拉刷新');
			let that = this;
			setTimeout(function() {
				that.page = 1,
				that.newsList = [],
				that.initList()
			}, 800);
		},
		//触底加载
		onReachBottom() {
			console.log('触底加载');
			if (this.status != 'nomore') {
				this.page = this.page + 1
				this.initList()
			}
		}
	}
</script>
<style>
	/* #ifdef MP-WEIXIN || H5 */
	page{
		background: #FFFFFF;
	}
	/* #endif */
	

</style>
<style scoped lang="scss">
.list-item{
	width: 690rpx;
	min-height:140rpx;
	margin: 0 auto;
	display: flex;
	
	flex-direction: column;
	
	margin-bottom: 30rpx;
	padding-bottom: 20rpx;
	border-bottom: 2rpx solid #F2F2F2;
}
.headimg{
width: 132rpx;
height: 132rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
}
.center{
	width: 690rpx;
	min-height: 102rpx;
	font-family: Source Han Sans, Source Han Sans;
	font-weight: 400;
	font-size: 28rpx;
	color: #333333;
	line-height: 36rpx;
	text-align: left;
	font-style: normal;
	text-transform: none;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
	margin-left: 36rpx;
	margin-right: 36rpx;
}
.name{
font-weight: 500;
font-size: 34rpx;
color: #333333;
margin-bottom: 20rpx;
}
.content{
	font-weight: 400;
	font-size: 30rpx;
	color: #333333;
}
.time{
	font-weight: 400;
	font-size: 26rpx;
	color: #666666;
	
}
.video_img{
	width: 80rpx;
	height: 102rpx;
	border-radius: 8rpx 8rpx 8rpx 8rpx;
	margin-left: 20rpx;
}
.order_name{
	font-weight: 400;
	font-size: 26rpx;
	color: #666666;
	margin-top: 20rpx;
}
</style>